package com.company.作业;

import java.util.Scanner;

public class sb {
    public static void main(String[] args) {
        System.out.println("请输入n");
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        int c=a(n);
        System.out.println(n+"以内的阶乘之和"+c);
    }
    public static int a(int n){
        int a =1;
        int sum =0;int sum1=0;
        for(int i =1; i <=n; i++) {
            for (int j = 1; j <= i; j++) {
                a = a * j;
                sum1+=a;
            }
            sum += sum1;
            sum1=0;
            a=1;
        }

        return sum;
    }

}












